<template>
  <div class="article-item">
    <!-- 文章列表分三种情况 1张图 3张图 无图 -->
    <van-cell
    :to="`/article/${article.art_id}`"
    >
        <!-- title部分 -->
        <div slot="title" class="title van-multi-ellipsis--l2">{{article.title}}</div>
        <!-- 右侧图片 -->
        <div slot="default" v-if="article.cover.type==1" class="right">
            <van-image
                fit="cover"
                :src="article.cover.images[0]"
            />
        </div>
        <!-- 下方 -->
        <div slot="label" class="down">
            <!-- 三张图片部分 -->
            <div v-if="article.cover.type==3" class="images">
                <van-image
                    v-for="(item,index) in article.cover.images" :key="index"
                    class="image-item"
                    fit="cover"
                    :src="item"/>
            </div>
            <!-- 底部 -->
            <span>{{article.aut_name}}</span>
            <span>{{article.comm_count}}</span>
            <span>{{article.pubdate | relativeTime}}</span>
        </div>
    </van-cell>

  </div>
</template>

<script>

export default {
  name: 'article-item',
  props: {
    article: {
      type: Object,
      requried: true
    }
  },
  created () {
    // console.log(this.article.art_id)
  },
  data () {
    return {

    }
  }
}
</script>

<style scoped lang="less">
    .article-item{
        .title {
            font-size: 32px;
            color: #3a3a3a;
        }
        .van-cell__value{
            flex: unset;
            width: 232px;
            height: 146px;
            margin-left: 20px;
        }
        //下图
        .down{

            .images{
                padding: 30px 0;
                display: flex;
                .image-item{
                    flex:1;
                    height: 146px;
                    &:not(:last-child){
                      margin-right: 4px;
                    }
                }
            }
             span {
                font-size: 22px;
                color: #b4b4b4;
                margin-right: 25px;
            }
        }

    }

</style>
